<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>博客管理</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
  <link rel="stylesheet" href="../static/css/me.css">
</head>
<body>

  <!--导航-->
  <nav th:replace="_fragments :: menu(1)" class="ui inverted attached segment m-padded-tb-mini m-shadow-small" >
  </nav>

  <!--中间内容-->
  
  <div  class="m-container m-padded-tb-big">
    <div class="ui container">
          <div class="ui top attached segment">   
            <div class="ui middle aligned two column grid">
              <div class="column">
                <h3 class="ui teal header">我的博客</h3>
              </div>
              <div class="right aligned column">
                <div class="right menu">
                  <div class="item">
                    <form name="mySearch" action="#" th:action="@{/blog-m/search}" method="post">
                      <div class="ui icon input input m-margin-tb-tiny">
                        <input type="text" name="str" placeholder="搜索我的博客..." th:value="${str}">
                        <i onclick="document.forms['blog-m/search'].submit()" class="search link icon"></i>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="ui attached  segment">
            <table th:fragment="blogList" class="ui compact teal table">
              <thead>
              <tr>
                <th></th>
                <th>标题</th>
                <th>推荐</th>
                <th>状态</th>
                <th>更新时间</th>
                <th>操作</th>
              </tr>
              </thead>
              <tbody>
              <tr th:each="blog,iterStat : ${page.content}">
                <td th:text="${iterStat.count}">1</td>
                <td th:text="${blog.title}">刻意练习清单</td>
                <td th:text="${blog.recommend} ? '是':'否'">是</td>
                <td th:text="${blog.published} ? '发布':'草稿'">草稿</td>
                <td th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd')}">2017-10-02 09:45</td>
                <td>
                  <a href="#" th:href="@{/blog-m/{id}/input(id=${blog.id})}" class="ui mini teal basic button">编辑</a>
                  <a href="#" th:href="@{/blog-m/{id}/delete(id=${blog.id})}" class="ui mini red basic button">删除</a>
                </td>
              </tr>
              </tbody>
              <tfoot>
              <tr>
                <th colspan="7">
                  <div class="ui mini pagination menu" th:if="${page.totalPages}>1" >
                    <a onclick="page(this)" th:attr="data-page=${page.number}-1" class="item" th:unless="${page.first}">上一页</a>
                    <a onclick="page(this)" th:attr="data-page=${page.number}+1" class=" item" th:unless="${page.last}">下一页</a>
                  </div>
                  <a href="#" th:href="@{/blog-m/input}" class="ui mini right floated teal basic button">新增</a>
                </th>
              </tr>
              </tfoot>
            </table>
            <div class="ui success message" th:unless="${#strings.isEmpty(message)}">
              <i class="close icon"></i>
              <div class="header">提示：</div>
              <p th:text="${message}">恭喜，操作成功！</p>
            </div>
          </div>
    </div>
  </div>

  <br>
  <br>

  <!--底部footer-->
  <footer th:replace="_fragments :: footer" class="ui inverted vertical segment m-padded-tb-massive"></footer>

  <!--/*/<th:block th:replace="_fragments :: script">/*/-->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
  <!--/*/</th:block>/*/-->

  <script>
    $('.menu.toggle').click(function () {
      $('.m-item').toggleClass('m-mobile-hide');
    });
    
    $('.ui.dropdown').dropdown({
      on : 'hover'
    });

    $('.wechat').popup({
      popup : $('.wechat-qr'),
      position: 'bottom center'
    });
    $('.qq').popup();

    //消息提示关闭初始化
    $('.message .close')
      .on('click', function () {
        $(this)
          .closest('.message')
                .transition('fade');
      });

    $('#clear-btn').on('click', function() {
      $('.ui.type.dropdown')
              .dropdown('clear');
    });

  </script>
</body>
</html>